package org.xlh.springboot;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import org.xlh.springboot.bean.User;

public class TestYAMLApi {
    public static void main(String[] args) throws JsonProcessingException {

        YAMLFactory yamlFactory = new YAMLFactory();

        ObjectMapper objectMapper = new ObjectMapper(yamlFactory);

        User user = new User("jack",20);

        String s = objectMapper.writeValueAsString(user);
        System.out.println(s);
    }
}
